package com.breakfast.fun.adapter.user;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.breakfast.fun.R;
import com.breakfast.fun.base.BaseListAdapter;
import com.breakfast.fun.data.entity.user.recharge.RechargeRecordData;

import java.util.List;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Created by yukai on 16/9/11.
 */
public class RechargeRecordAdapter extends BaseListAdapter<RechargeRecordData> {

    public RechargeRecordAdapter(Context context, List<RechargeRecordData> list) {
        super(context, list);
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        final ViewHolder holder;
        if (convertView == null) {
            convertView = LayoutInflater.from(mContext).inflate(R.layout.item_recharge_record, null);
            holder = new ViewHolder(convertView);
            convertView.setTag(holder);
        } else {
            holder = (ViewHolder) convertView.getTag();
        }

        RechargeRecordData data = getItem(position);

        holder.mTvItemRechargeRecordMoney.setText("￥ " + data.getMoney() + " 充值成功");
        holder.mTvItemRechargeRecordTime.setText(data.getAddTime());
        return convertView;
    }


    static class ViewHolder {
        @Bind(R.id.tv_item_recharge_record_money)
        TextView mTvItemRechargeRecordMoney;
        @Bind(R.id.tv_item_recharge_record_time)
        TextView mTvItemRechargeRecordTime;

        ViewHolder(View view) {
            ButterKnife.bind(this, view);
        }
    }
}
